package com.hanoi.wiki.model.json;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.hanoi.wiki.model.Category;
import com.hanoi.wiki.model.CategoryType;
import com.hanoi.wiki.model.Places;
import com.hanoi.wiki.model.PlacesInQueued;

public class CategoryJson extends BaseJsonObject implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private int id;
	private String categoryName;
	private int status;
	private int priority;
	private String description;
	private List<Integer> categoryTypes;
	private List<Integer> places;
	private List<Integer> placesInQueueds;
	
	public CategoryJson() {
		categoryTypes = new ArrayList<Integer>();
		places = new ArrayList<Integer>();
		placesInQueueds = new ArrayList<Integer>();
	}
	
	public CategoryJson(Category category) {
		this();
		if(category != null) {
			this.id = category.getId();
			this.categoryName = category.getCategoryName();
			this.status = category.getStatus();
			this.priority = category.getPriority();
			this.description = category.getDescription();
			
			for (CategoryType categoryType : category.getCategoryTypes()) {
				if(categoryType != null) {
					categoryTypes.add(categoryType.getId());
				}
			}
			
			for (Places place : category.getPlaces()) {
				if(place !=null) {
					places.add(place.getId());
				}
			}
			
			for (PlacesInQueued placesInQueued : category.getPlacesInQueueds()) {
				if(placesInQueued !=null) {
					placesInQueueds.add(placesInQueued.getId());
				}
			}
		}
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getCategoryName() {
		return categoryName;
	}
	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public int getPriority() {
		return priority;
	}
	public void setPriority(int priority) {
		this.priority = priority;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public List<Integer> getCategoryTypes() {
		return categoryTypes;
	}
	public void setCategoryTypes(List<Integer> categoryTypes) {
		this.categoryTypes = categoryTypes;
	}
	public List<Integer> getPlaces() {
		return places;
	}
	public void setPlaces(List<Integer> places) {
		this.places = places;
	}
	public List<Integer> getPlacesInQueueds() {
		return placesInQueueds;
	}
	public void setPlacesInQueueds(List<Integer> placesInQueueds) {
		this.placesInQueueds = placesInQueueds;
	}
}
